package com.jingtai.platform.controller.merchants;

import com.jingtai.core.entity.merchants.MerchantsAddress;
import com.jingtai.platform.service.merchants.MerchantsAddressService;
import com.jingtai.platform.util.ResultUtil;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import com.jingtai.validate.swagger.CApiParam;

/**
 * 商户收货地址表
 *
 * @author sunlaiqian
 * @date 2020-12-02 18:31:32
 */
@Validated
@RestController
@RequestMapping("/platform/merchantsaddress")
@Api(tags = "商户收货地址表")
public class MerchantsAddressController{

    @Autowired
    private MerchantsAddressService merchantsAddressService;


    @ApiOperation("商户收货地址表列表查询")
    @GetMapping("/list")
    public ResultUtil aopMerchantsAddressList(@CApiParam(name = "page",value = "页数",required = true,cNotEmpty = true,cIntMin = 1) @RequestParam("page") Integer page,
                              @CApiParam(name = "limit",value = "每页个数",required = true,cNotEmpty = true,cIntMin = 1) @RequestParam("limit") Integer limit,
                              @CApiParam(name = "conditions",value = "查询条件",required = false) @RequestParam("conditions") String conditions){
        return merchantsAddressService.MerchantsAddresslist(page, limit, conditions);
    }


    @ApiOperation("根据ID查询merchantsAddress实体")
    @GetMapping("/getMerchantsAddressById")
    public ResultUtil GetMerchantsAddressById(@CApiParam(name = "id",value = "merchantsAddress实体ID",required = true,cNotEmpty = true) @RequestParam("id") Long id){
        return merchantsAddressService.getMerchantsAddressById(id);
    }


    @ApiOperation("新增merchantsAddress实体")
    @PostMapping("/add")
    @ApiOperationSupport(ignoreParameters = {"merchantsAddress.id","merchantsAddress.createTime","merchantsAddress.updateTime","merchantsAddress.deleteFlag"})
    public ResultUtil aopAddMerchantsAddress(@RequestBody @Validated MerchantsAddress merchantsAddress){
        return merchantsAddressService.addMerchantsAddress(merchantsAddress);
    }

    @ApiOperation("编辑merchantsAddress实体")
    @PostMapping("/edit")
    @ApiOperationSupport(ignoreParameters = {"merchantsAddress.createTime","merchantsAddress.updateTime","merchantsAddress.deleteFlag"})
    public ResultUtil aopEditMerchantsAddress(@RequestBody @Validated MerchantsAddress merchantsAddress){
        return merchantsAddressService.editMerchantsAddress(merchantsAddress);
    }

    @ApiOperation("根据ID删除merchantsAddress实体")
    @GetMapping("/delMerchantsAddressById")
    public ResultUtil aopDelMerchantsAddressById(@CApiParam(name = "id",value = "merchantsAddress实体ID",required = true,cNotEmpty = true) @RequestParam("id") Long id){
        return merchantsAddressService.delMerchantsAddressById(id);
    }

}






